package com.xuecheng.content.api;

import com.xuecheng.content.model.dto.CourseCategoryTreeDto;
import com.xuecheng.content.service.CourseCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 课程分类 前端控制器
 *
 * @author : [lm]
 * @version : [v1.0]
 * @createTime : [2023/10/24 20:49]
 */
@Api(value = "课程分类信息查询接口", tags = "课程分类信息查询接口")
@Slf4j
@RestController
@RequestMapping("/course-category")
public class CourseCategoryController {
    /**
     * 课程分类根节点
     */
    public static final String ROOT_NODE = "1";

    @Resource
    CourseCategoryService courseCategoryService;

    @ApiOperation("课程分类信息查询接口")
    @GetMapping("/tree-nodes")
    public List<CourseCategoryTreeDto> queryTreeNodes() {
        return courseCategoryService.queryTreeNodes(ROOT_NODE);
    }
}
